@extends('admin.base')

@section('content')
    <style>
        .layui-fluid{
            padding: 0px !important;
        }
    </style>
    <div class="layui-card">
        <div class="layui-card-header layuiadmin-card-header-auto">
            <h2>创建平台</h2>
        </div>
        <div class="layui-card-body">
            <form action="" method="post" class="layui-form">
                {{csrf_field()}}
                <div class="layui-form-item">
                    <label for="" class="layui-form-label">平台名称</label>
                    <div class="layui-input-block">
                        <input class="layui-input" type="text" name="display_name" lay-verify="required" value="{{$role->name??old('name')}}" placeholder="请输入您的平台名称">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="" class="layui-form-label">平台标记</label>
                    <div class="layui-input-block">
                        <input class="layui-input" type="text" name="name" lay-verify="required" value="{{$role->display_name??old('display_name')}}" placeholder="请输入您的平台标记" >
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn layui-btn-normal" lay-submit  lay-filter="*"  lay-filter="formDemo">提 交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重 置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
@endsection
@section('script')
    <script>
        layui.use('form', function(){
            var form = layui.form;
            form.on('submit(*)', function(data){
                http.post('{{route('platform.platform.store')}}',data.field,function (res){
                    layer.msg('添加成功', {icon: 1});
                    setTimeout(function () {
                        parent.location.reload();
                    },1500);
                })
                return false;
            });
        });
    </script>
@endsection